<?php
namespace Sms;

class SmsSender
{
    private $sender;

    function __construct($driver = null, $config = [])
    {
        $driver = $driver ? : C('DEFAULT_SMS_SENDER');
        $config = array_merge($config, C('SDK_' . strtoupper($driver)));
        $class  = strpos($driver, '\\') ? $driver : __NAMESPACE__ . '\\Driver\\' . ucfirst(strtolower($driver));
        $this->sender = new $class($config);
    }

    public function send($rec_num, $tpl_code, $params)
    {
       return $result = $this->sender->send($rec_num, $tpl_code, $params);

    }

    public function getError()
    {
        return $this->sender->getError();
    }


}
